package com.jiguang.property.controller;


import com.jiguang.property.annotation.Log;
import com.jiguang.property.dto.ParkInfoDTO;
import com.jiguang.property.dto.UpkeepInfoDTO;
import com.jiguang.property.service.ParkInfoService;
import com.jiguang.property.service.UpkeepInfoService;
import com.jiguang.property.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2025-03-24
 */
@RestController
    @RequestMapping("/upkeepInfo")
public class UpkeepInfoController {

    @Autowired
    private UpkeepInfoService upkeepInfoService;

    @ApiOperation(value = "查询维修")
    @PostMapping("list")
    @Log(name = "查询维修列表")
    public Result list(@RequestBody UpkeepInfoDTO upkeepInfoDTO) {
        return upkeepInfoService.listUpkeepInfo(upkeepInfoDTO);
    }

    @ApiOperation(value = "查询上报数量和待解决数")
    @PostMapping("getUpkeepNumber")
    public Result getUpkeepNumber() {
        return upkeepInfoService.getUpkeepNumber();
    }

    @ApiOperation(value = "通过ID删除维修信息")
    @PostMapping("delete")
    @Log(name = "删除维修信息")
    public Result delete(String upkeepIds) {
        return upkeepInfoService.deleteUpkeepInfo(upkeepIds);
    }

    @ApiOperation(value = "新增维修信息")
    @PostMapping("saveOrUpdate")
    @Log(name = "操作维修信息")
    public Result updateOrAdd(@RequestBody UpkeepInfoDTO upkeepInfoDTO) {
        return upkeepInfoService.updateOrAddUpkeepInfo(upkeepInfoDTO);
    }
}

